﻿<html xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>添加组</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <div th:include="layout/resources :: resources"></div>
</head>
<body>
<div class="container">
    <div style="margin-top: 50px;">
        <form id="form" class="form-horizontal" method="post">
            <div class="form-group">
                <label for="groupName" class="col-sm-2 control-label">组名</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="groupName" name="groupName">
                </div>
            </div>
            <div class="form-group text-center">
                    <button type="button" onclick="add();" class="btn btn-default">添加</button>
            </div>
        </form>
    </div>
</div>
</body>
<script th:inline="javascript">
    function add() {
        $.ajax({
            method: "post",
            url: createUrl("/group/add"),
            data: $('#form').serialize(),
            success: function (result) {
                if (result.errorCode == 0) {
                    framework.successMsg("添加成功");
                } else {
                    framework.errorMsg("添加失败")
                }
            }
        })
    }
</script>
</html>
